package com.powernode.service.impl;

import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.powernode.entity.Prod;
import com.powernode.entity.ProdComm;
import com.powernode.service.ProdCommService;
import com.powernode.mapper.ProdCommMapper;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Date;

/**
* @author yanju
* @description 针对表【prod_comm(商品评论)】的数据库操作Service实现
* @createDate 2024-11-06 10:20:05
*/
@Service
public class ProdCommServiceImpl extends ServiceImpl<ProdCommMapper, ProdComm>
    implements ProdCommService{

    @Resource
    private ProdCommMapper prodCommMapper;

    /**
     * 回复和审核商品评论
     * @param prodComm
     * @return
     */
    @Override
    public Boolean replyAndExamineProdComm(ProdComm prodComm) {
        //获取评论内容
        String replyContent = prodComm.getContent();
        if (StrUtil.isNotBlank(replyContent)){
            prodComm.setReplyTime(new Date());
            prodComm.setReplySts(1);
        }

        return prodCommMapper.updateById(prodComm) > 0;
    }
}




